package com.ck567.springbootnettyprotobufjava.handler.login;


import com.ck567.springbootnettyprotobufjava.handler.MessageHandler;
import com.ck567.springbootnettyprotobufjava.message.entity.LoginProto;
import com.ck567.springbootnettyprotobufjava.utils.OptionType;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @description: 登录处理器
 */
@Component
@ChannelHandler.Sharable
@Slf4j
public class LoginHandler implements MessageHandler<LoginProto.LoginReq> {


    @Override
    @SneakyThrows
    @SuppressWarnings("rawtypes")
    public void execute(Channel channel, LoginProto.LoginReq message) {
        System.out.println("login success!, user:"+ message.toString());
    }

    @Override
    public Short getType() {
        return OptionType.LoginReq.getType();
    }

}
